using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class ActPriorityAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public ActPriorityAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v27] = new string[]{"A","CR","CS","CSP","CSR","EL","EM","P","PRN","R","RR","S","T","UD","UR"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v27] = new string[]{"ASAP - As soon as possible, next highest priority after stat","Callback results - filler should contact the placer as soon as results are available, even for preliminary results","Callback for scheduling - Filler should contact the placer (or target) to schedule the service.","Callback placer for scheduling - filler should contact the placer to schedule the service","Contact recipient for scheduling - Filler should contact the service recipient (target) to schedule the service","Elective - Beneficial to the patient but not essential for survival.","Emergency - An unforeseen combination of circumstances or the resulting state that calls for immediate action","Preop - Used to indicate that a service is to be performed prior to a scheduled surgery.  When ordering a service and using the pre-op priority, a check is done to see the amount of time that must be allowed for performance of the service.  When the order","As needed - An \"as needed\" order should be accompanied by a description of what constitutes a need.  This description is represented by an observation service predicate as a precondition.","Routine - Routine service, do at usual work hours","Rush reporting - A report should be prepared and sent as quickly as possible","Stat - With highest priority (e.g. emergency).","Timing critical - It is critical to come as close as possible to the requested time (e.g. for a through antimicrobial level).","Use as directed - Drug is to be used as directed by the prescriber.","Urgent - Calls for prompt action"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
